package com.zjj.fanshe.proxy.dongtai;

/**
 * @author zhoujunjie
 * @desc TODO
 * @date
 */
import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
        ArithmeticCalculator target = new Calculator();
        LogInvocationHandler handler = new LogInvocationHandler(target);
        ArithmeticCalculator proxy = (ArithmeticCalculator) Proxy.newProxyInstance(
                target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),
                handler
        );
        int addResult = proxy.add(1, 2);
        int subResult = proxy.sub(3, 1);
    }
}